﻿using System;
using System.Windows;
using System.Windows.Controls;

namespace WIAssistant
{
    /// <summary>
    /// Interaction logic for ManualMapping.xaml
    /// </summary>
    public partial class ManualMapping : Window
    {
        private readonly ManualMappingVM _vm;

        // Do NOT Use
        public ManualMapping()
        {}

        public ManualMapping(WorkItemTypeMapping mapping)
        {

            _vm = new ManualMappingVM(mapping);
            DataContext = _vm;

            InitializeComponent();
        }

        private void DropPanel_Initialized(object sender, EventArgs e)
        {
            WrapPanel panel = (WrapPanel) sender;
            SourceField sourceField = (SourceField) panel.DataContext;
            _vm.Mapping.AddMappedDestItemGUI(panel, sourceField.SrcField);
        }
    }
}
